<?php

class_exists('Database') || require('class.Database.php');

class Conflicts {


	public function get_html()
	{

		$database = new Database();
		$trip = $database->getTrip("1");
		$trips = $database->getConflicts("1");
		$conflicts = array();

		$org = $trip['origin'];
		$dest = $trip['destination'];
		

		foreach ($trips as $t)
		{
			if ($t['origin'] == $org)
			{
				$conflicts[] = $t;
			}
		}

		$output_html = <<<HTM
			<h1>Conflicts</h1>
			<div class="table-vehicles">
				<div class="row">
					<div class="column-1 colour-secondary">Origin</div>
					<div class="column-2 colour-secondary">Destination</div>
				</div>
HTM;

		if($rowHighlight=="")
				$rowHighlight = " colour-tietary";
			else $rowHighlight = "";

		foreach ($conflicts as $c)
		{
			$org = $c['origin'];
			$dest = $c['destination'];

			$output_html .= <<<HTM
<div class="row">
					<div class="column-1$rowHighlight">$org</div>
					<div class="column-2$rowHighlight">$dest</div>
				</div>
HTM;
		}


		return $output_html;

	}
}

?>